﻿using System;
using System.Collections.Generic;
using System.Text;
using DotNet.Data;
using System.Data;
namespace DotNet.Business
{
	public class Tab_NewsBll
	{
		Tab_NewsDal tDal=new Tab_NewsDal();

		#region 是否存在该记录
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int NewID)
		{
			return tDal.Exists(NewID);
		}
		#endregion

		#region 获得数据列表
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public IList<Tab_News> GetModel()
		{
			return tDal.GetModel();
		}
		#endregion

        #region 根据新闻类别ID查询新闻列表
        /// <summary>
        /// 根据新闻类别ID查询新闻列表
        /// </summary>
        /// <param name="newClassID">新闻类别ID</param>
        /// <returns></returns>
        public IList<Tab_News> GetModelByClass(int newClassID)
        {
            return tDal.GetModelByClass(newClassID);
        }
        #endregion

        #region 根据标识列获得数据实体
        /// <summary>
		/// 根据标识列获得数据实体
		/// </summary>
		/// <param name="NewID">标识列</param>
		/// <returns></returns>
		public Tab_News GetModel(int NewID)
		{
			return tDal.GetModel(NewID);
		}
		#endregion

		#region 修改信息
		/// <summary>
		/// 修改信息
		/// </summary>
		/// <param name="Tab_News">实体</param>
		/// <returns></returns>
		public bool Update(Tab_News tab_news)
		{
			 return tDal.Update(tab_news);
		}
		#endregion

		#region 删除信息
		/// <summary>
		/// 删除信息
		/// </summary>
		/// <param name="NewID">标识列</param>
		/// <returns></returns>
		public bool Delete(int NewID)
		{
			 return tDal.Delete(NewID);
		}
		#endregion

		#region 添加信息
		/// <summary>
		/// 添加信息
		/// </summary>
		/// <param name="Tab_News">实体</param>
		/// <returns></returns>
		public bool Insert(Tab_News tab_news)
		{
			 return tDal.Insert(tab_news);
		}
		#endregion

        #region 新闻分页
        /// <summary>
        /// 新闻分页
        /// </summary>
        /// <param name="pageIndex">索引</param>
        /// <param name="pageSize">页数</param>
        /// <param name="newClassID">新闻类别ID</param>
        /// <returns></returns>
        public DataTable pageForNews(int pageIndex,int pageSize,int newClassID)
        {
            if (newClassID == 0)
            {
                return tDal.pageForNews(pageIndex, pageSize);
            }
            else
            {
                return tDal.pageForNews(pageIndex, pageSize, newClassID);
            }
        }
        #endregion

        #region 获得新闻数量
        /// <summary>
        /// 获得新闻数量
        /// </summary>
        /// <param name="newClassID">新闻类别ID</param>
        /// <returns></returns>
        public int getRecordCount(int newClassID) 
        {
            if (newClassID == 0)
            {
                return tDal.getRecordCount();
            }
            else
            {
                return tDal.getRecordCount(newClassID);
            }
        }
        #endregion
    }
}
